﻿using System;
using System.Collections.Generic;
using System.Text;

namespace BlueLotus7.Contract
{
    public class SessionTicket
    {
        //Guid userKey;
        //string personName;
        //string loginId;
        //string token;
        //DateTime createdStamp;
        //DateTime expiredStamp;
        //TimeSpan expiredOffset;
        //Guid[] roleKeys;
        //AuthorityLevel authorityLevel;

        //public Guid UserKey
        //{
        //    get { return userKey; }
        //}
        //public string PersonName
        //{
        //    get { return personName; }
        //}
        //public string LoginId
        //{
        //    get { return loginId; }
        //}
        //public string Token
        //{
        //    get { return token; }
        //}
        //public DateTime CreatedStamp
        //{
        //    get { return createdStamp; }
        //}
        //public DateTime ExpiredStamp
        //{
        //    get { return expiredStamp; }
        //}
        //public Guid[] RoleKeys
        //{
        //    get { return roleKeys; }
        //}
        //public AuthorityLevel AuthorityLevel
        //{
        //    get { return authorityLevel; }
        //    set { authorityLevel = value; }
        //}

        //public bool Expired
        //{
        //    get
        //    {
        //        return expiredStamp < DateTime.Now;
        //    }
        //}

        //private SessionTicket(User user, Person person, Guid[] roleKeys, string token, TimeSpan expiredOffset)
        //{
        //    this.userKey = user.Key;
        //    this.loginId = user.LoginId;
        //    this.personName = person.PersonName;
        //    this.roleKeys = roleKeys;

        //    this.token = token;
        //    this.expiredOffset = expiredOffset;

        //    this.createdStamp = DateTime.Now;
        //    this.expiredStamp = createdStamp + this.expiredOffset;
        //}

        //public void UpdateExpiredStamp()
        //{
        //    expiredStamp += expiredOffset;
        //}

        //public static SessionTicket GenerateSessionTicket(User user, Person person, Guid[] roleKeys, string token, TimeSpan expiredOffset)
        //{
        //    SessionTicket sessionTicket = null;
        //    if (user != null && person != null && user.UserKey == person.PersonKey)
        //    {
        //        sessionTicket = new SessionTicket(user, person, roleKeys, token, expiredOffset);
        //    }
        //    return sessionTicket;
        //}
    }
}
